import { Module } from '@nestjs/common';
import { UploadService } from './upload.service';
import { UploadController } from './upload.controller';
import { MulterModule } from '@nestjs/platform-express'
import { extname,join } from 'path'
import { diskStorage } from 'multer'

@Module({
  imports:[
    MulterModule.register({
      storage:diskStorage({
        destination:join(__dirname,'../images'),
        filename:(_,file,cb)=>{
          console.log("upload Moudle",file)
          return cb(null, file.originalname)
        }
      })
    })
  ],
  controllers: [UploadController],
  providers: [UploadService]
})
export class UploadModule {}
